package com.zzl.controller;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.system.common.pojo.BisBusinessOrder;
import com.zzl.service.ZzlBisBusinessOrderService;
@Controller
@RequestMapping("bbo")
public class ZzlBisBusinessOrderController {
	@Autowired
	private ZzlBisBusinessOrderService bboService;
	@RequestMapping("listbbo")
	public String listbbo(Model model,HttpServletRequest request){
		Map<String,Object> map=mohu(request);
		List<BisBusinessOrder> list=bboService.list(map);
		int extendIncome=bboService.getextendIncome();
		int cashIncome=bboService.getcashIncome();
		model.addAttribute("extendIncome", extendIncome);
		model.addAttribute("cashIncome", cashIncome);
		model.addAttribute("list", list);
		return "/zzljsp/bboList";
	}
	private Map<String,Object> mohu(HttpServletRequest request){
		Map<String,Object> map=new HashMap<>();
		String qpayTime = request.getParameter("qpayTime");
		
		if(qpayTime!=null&&qpayTime!=""){
			map.put("qpayTime", qpayTime);
		}
		String qshopUserName = request.getParameter("qshopUserName");
		
		if(qshopUserName!=null&&qshopUserName!=""){
			map.put("qshopUserName", qshopUserName);
		}
		
		return map;
	}
	@RequestMapping("listuser")
	public String listuser(Model model,HttpServletRequest request){
		Map<String,Object> map=mohu(request);
		List<BisBusinessOrder> list=bboService.list(map);
		int extendIncome=bboService.getextendIncome();
		int cashIncome=bboService.getcashIncome();
		model.addAttribute("extendIncome", extendIncome);
		model.addAttribute("cashIncome", cashIncome); 
		model.addAttribute("list", list);
		return "/zzljsp/userList";
	}
	
	@RequestMapping("list")
	public String list(){
		return "/zzljsp/caiwu";
	}
}
